//navbar

function renderNavbar(pathname) {
    //数据
    let arr = [
      {
        title: '跑步',
        path: './run.html',
      },
      {
        title: '骑行',
        path: './ride.html',
      },
      {
        title: '课程训练',
        path: './course.html',
      },
    ]
    //模板
    let html = `
          ${arr
            .map(v => {
              return `<a href="${v.path}" class="item df aic ${
                v.path === `./${pathname}.html` && 'active'
              }">${v.title}</a>`
            })
            .join('')}
      `
    const div = document.createElement('div')
    div.className = 'navbar df jcsa aic'
    div.innerHTML = html
    document.body.prepend(div)
  }
  
  //导出渲染函数
  module.exports = renderNavbar